import java.util.Arrays;

public class 插入排序 {
    public static void main(String[] args) {
        int[] arr={9,8,3,6,5,4,3,2,1,2,3,4,7,6,7,8,9};
        int temp;
        for (int i = 1; i < arr.length; i++){
            temp=arr[i];
            int j=i-1;
            for (;j>=0;j--){
                if (temp<arr[j]){
                    arr[j+1]=arr[j];
                }else break;
            }
            arr[j+1]=temp;
        }
        System.out.println(Arrays.toString(arr));
    }
}
